﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
using Innvoice.Logica.GestorObject;

namespace Innvoice.Ws.Clientes.Reportes
{
    public partial class FReporte : Form
    {
        //List<Cliente> listCliente = new List<Cliente>();
        object miLista = new object();
        string miRdlc = "Innvoice.Ws.Clientes.Reportes.RptCliente.rdlc";
        string miNameDataSet = "DataSetCliente";
        
        public FReporte(object m_lista)
        {
            InitializeComponent();
            miLista = m_lista;
        }

        public FReporte(object lista, string rdlc, string nameDataSet)
        {
            InitializeComponent();
            miLista = lista;
            miRdlc = rdlc;
            miNameDataSet = nameDataSet;
        }

        private void FReporte_Load(object sender, EventArgs e)
        {
            reportViewer.LocalReport.DataSources.Clear(); //clear report
            reportViewer.LocalReport.ReportEmbeddedResource = miRdlc; // bind reportviewer with .rdlc

            ReportDataSource dataset = new ReportDataSource(miNameDataSet, miLista); // set the datasource
            reportViewer.LocalReport.DataSources.Add(dataset);
            dataset.Value = miLista;

            reportViewer.LocalReport.Refresh();
            reportViewer.RefreshReport(); // refresh report            
            //this.reportViewer1.RefreshReport();
        }
    }
}
